import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import com.jplus.core.db.JdbcTemplate;
import com.jplus.core.utill.HttpClientUtil;
import com.jplus.core.utill.SimpleSql;

/**
 * TEST
 */
public class TEST {
    static Properties prop = new Properties();
    static JdbcTemplate saas;
    static SimpleSql sql;

    public static void main(String[] args) throws Exception {
        prop.load(new FileInputStream(new File("D:/config/LY_PRD_JDBC.properties")));
        saas = new JdbcTemplate(GET(prop, "saas.jdbcurl"), GET(prop, "saas.user"), GET(prop, "saas.pass"));
        sql = new SimpleSql("simple.sql");

        List<Map<String, Object>> list = saas.queryList(sql.get("listSaasAuth"));
        HttpClientUtil http = new HttpClientUtil();
        String url = "https://saas.lianyuplus.com/saas20/api/free/AptHerelink/door/lock/sync/iot/auth";

        for (Map<String, Object> map : list) {
            String id = String.valueOf(map.get("id"));
            Map<String, Object> param = new HashMap<>();
            param.put("authType", 1);
            param.put("doorLockPrivilegeId", id);
            System.out.println(param);
            System.out.println(http.doPost(url, param));
        }
    }

    static String GET(Properties prop, String key) {
        return prop.getProperty(key);
    }
}